<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.27.2/axios.js"></script>
<body>
    <h1>注册页面</h1>
    用户名：<input type="text" class="user"><br>
    密  码: <input type="text" class="password"><br>
    <button class="btn">注册</button><br>
</body>
<script>
    let user=document.querySelector('.user');
    let password=document.querySelector('.password');
    let btn=document.querySelector('.btn');

    btn.onclick = function() {
        axios.post('/register',{
            userName:user.value,
            password:password.value
        }).then((res) => {
            console.log(user.value,password.value);
            alert('注册成功');
            location.href='login.html';
        })
    }
</script>
</html>